import axios from "axios";

axios.defaults.baseURL = "http://127.0.0.1:8888/api/private/v1/";
axios.interceptors.request.use(config => {
  // console.log(config);
  config.headers.Authorization = window.sessionStorage.getItem("token");
  return config;
});

axios.defaults.timeout = 5000;

function requestPost(url, data) {
  return axios.post(url, data);
}
function requestGet(url, data) {
  return axios.get(url, data);
}
function requestPut(url, data) {
  return axios.put(url, data);
}
function requestDelete(url, data) {
  return axios.delete(url, data);
}

export { requestPost, requestGet, requestPut, requestDelete };
